<?php
//ref: http://devzone.zend.com/article/3450 decorators etc.

	class Default_Form_Backend_Role extends Default_Form_Common
	{
	    public function init()
	    {
			parent::init();
	    }

		public function add()
	    {

			$name = $this->createElement('text', 'name');
			$name->setLabel('definitions:Name')
	               	->setRequired(true)
	               	->addValidator('stringLength', false, array(3, 120))
	               	->addFilter('StripTags')
	               	//->addFilter('StringTrim')
	               	;

			$label = $this->createElement('text', 'label');
			$label->setLabel('label')
	               	->setRequired(true)
	               	->addValidator('stringLength', false, array(3, 120))
	               	->addFilter('StripTags')
	               	//->addFilter('StringTrim')
	               	;

	        $model = new Default_Model_DbTable_Role();
	        $roles = $model->getRolesAsPairs();
			$parent = new Zend_Form_Element_Select('parent');
			$parent->setLabel('Roles:Inherits from')
			         ->setRequired(true)
			         ->addMultiOption('', 'select-label')
			         ->addMultiOptions($roles)
			         ;

	        $isActive = $this->createElement('checkbox', 'isActive');
			$isActive->setLabel('is-active');


			$this->addElement($name)
			     ->addElement($label)
			     ->addElement($parent)
			     ->addElement($isActive)
			     ;



	    }

		public function edit()
	    {
	    	$this->add();

			$editId = $this->createElement('hidden', 'editId');

			$this->addElement($editId);


	    }

	}
